var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, n, i) {
    var o, s = arguments.length, a = s < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, n) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, n, i); else for (var c = e.length - 1; 0 <= c; c--) (o = e[c]) && (a = (s < 3 ? o(a) : 3 < s ? o(t, n, a) : o(t, n)) || a);
    return 3 < s && a && Object.defineProperty(t, n, a), a;
};

Object.defineProperty(n, "__esModule", {
    value: !0
}), n.SkinItemValue = n.SkinItemData = n.SkinItemType = void 0;

var r, s = e("MyScrollView"), c = e("PrefabView"), l = e("Global"), d = e("AudioManager"), u = e("EggsPersonView"), p = e("EggsGTQ"), h = e("EggsDJATM"), f = e("EggsGYATM"), g = e("EggsDNATM"), m = e("EggsHDL"), y = e("GameConfig"), v = e("GameData"), w = e("EggsTS"), b = e("EggsManager"), P = e("ActivityManager"), I = e("NewActivityEggsView"), G = e("LoadManager"), _ = e("UIManager"), A = e("AdManager"), k = e("EggsZTATM"), M = e("WebManager"), C = e("FSVideoAdManager"), D = cc._decorator, S = D.ccclass, O = D.property;

!function(e) {
    e[e.PET = 0] = "PET", e[e.PERSON = 1] = "PERSON", e[e.GUN = 2] = "GUN", e[e.EQUIP = 3] = "EQUIP", 
    e[e.EGG = 4] = "EGG";
}(r = n.SkinItemType || (n.SkinItemType = {}));

var R = function() {};

n.SkinItemData = R, n.SkinItemValue = function(e, t, n, i, o, s) {
    void 0 === t && (t = 0), void 0 === n && (n = 0), void 0 === i && (i = 0), void 0 === o && (o = 0), 
    void 0 === s && (s = 0), this.atk = e = void 0 === e ? 0 : e, this.spe = t, this.ran = n, 
    this.cri = i, this.mov = o, this.hp = s;
};

var T = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.petView = null, e.personView = null, e.gunView = null, e.equipView = null, 
        e.person = null, e.skin = null, e.toggleContainer = null, e;
    }
    return i(e, t), e.prototype.onLoad = function() {
        y.GC.isVaild(this.text + "_inter") || A.default.getInstance().showInterstitialAd(this.text);
    }, e.prototype.onDisable = function() {
        C.default.getInstance().doShowFSVideo(this.text), this.node.destroy();
    }, e.prototype.onDestroy = function() {
        _.default.getInstance().releasePnl(this.text), _.default.getInstance().showPnl("start");
    }, e.prototype.onToggle = function(e) {
        e = e.target;
        if (e instanceof cc.Node) switch (e.getSiblingIndex()) {
          case 0:
            this.onClickPet();
            break;

          case 1:
            this.onClickSkin();
            break;

          case 2:
            this.onClickArm();
            break;

          case 3:
            this.onClickEquip();
        }
    }, e.prototype.onClickBack = function() {
        d.default.getInstance().playAudio("按钮2"), M.default.getInstance().sentLog("点击皮肤界面返回按键"), 
        this.hidePnl();
    }, e.prototype.onClickArm = function() {
        this.showItem(r.GUN);
    }, e.prototype.onClickSkin = function() {
        this.showItem(r.PERSON);
    }, e.prototype.onClickPet = function() {
        this.showItem(r.PET);
    }, e.prototype.onClickEquip = function() {
        this.showItem(r.EQUIP);
    }, e.prototype.start = function() {
        this.petView.init(y.GC.petModelList.map(function(e, t) {
            var n = new R();
            return n.rank = t, n.type = r.PET, n;
        })), this.personView.init(l.G.personModelList.map(function(e) {
            var t = new R();
            return t.rank = e.id, t.type = r.PERSON, t;
        })), this.gunView.init(l.G.gunModelList.concat(l.G.olympicGunModelList.filter(function(e) {
            return v.GD.gunOwnList.includes(e.id);
        })).map(function(e) {
            var t = new R();
            return t.rank = e.id, t.type = r.GUN, t;
        })), this.equipView.init(y.GC.equipConfigList.map(function(e) {
            var t = new R();
            return t.rank = e.id, t.type = r.EQUIP, t;
        })), this.initEggs(), (-1 < v.GD.backEquipIdx || -1 < v.GD.headEquipIdx) && cc.systemEvent.emit("equip_warn", !1);
    }, e.prototype.initEggs = function() {
        var e, t = this;
        G.default.getInstance().loadRes({
            url: "prefab/eggsPerson",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.node, e.getComponent(u.default).personView = t.personView.personView);
        }), -1 == b.default.getInstance().checkEggGun(7) && G.default.getInstance().loadRes({
            url: "prefab/eggsGTQ",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.node, e.getComponent(p.default).personView = t.personView.personView);
        }), -1 == b.default.getInstance().checkEggPerson(15) && G.default.getInstance().loadRes({
            url: "prefab/eggsHDL",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.personView.node, (e = e.getComponent(m.default)).personView = t.personView.personView, 
            e.target = t.personView.changeBtn.node, e.init());
        }), -1 == b.default.getInstance().checkEggPerson(17) && G.default.getInstance().loadRes({
            url: "prefab/eggsDJATM",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.personView.node, (e = e.getComponent(h.default)).personView = t.personView.personView, 
            e.target = t.personView.changeBtn.node, e.init());
        }), -1 == b.default.getInstance().checkEggPerson(18) && G.default.getInstance().loadRes({
            url: "prefab/eggsGYATM",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.personView.node, (e = e.getComponent(f.default)).personView = t.personView.personView, 
            e.target = t.personView.changeBtn.node, e.init());
        }), -1 == b.default.getInstance().checkEggPerson(19) && G.default.getInstance().loadRes({
            url: "prefab/eggsDNATM",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.personView.node, (e = e.getComponent(g.default)).personView = t.personView.personView, 
            e.target = t.personView.changeBtn.node, e.init());
        }), -1 == b.default.getInstance().checkEggPerson(20) && G.default.getInstance().loadRes({
            url: "prefab/eggsTS",
            type: cc.Prefab
        }).then(function(e) {
            cc.isValid(t) && ((e = cc.instantiate(e)).parent = t.personView.personView.node, 
            (e = e.getComponent(w.default)).personView = t.personView.personView, e.target = t.personView.personView.node.getChildByName("skin"), 
            e.init());
        }), -1 == b.default.getInstance().checkEggPerson(25) && P.ActivityManager.getInstance().checkActivity(P.ActivityType.FIFTH) && ((e = new cc.Node()).parent = this.personView.personView.node, 
        e.addComponent(I.default).init({
            id: 25,
            type: I.NewActivityEggType.CLICK,
            num: 10,
            options: {
                pos: cc.v2(0, 100),
                size: cc.size(175, 200),
                personView: this.personView.personView,
                personIdx: 13
            }
        })), -1 == b.default.getInstance().checkEggPerson(27) && P.ActivityManager.getInstance().checkActivity(P.ActivityType.SEVENTH) && ((e = new cc.Node()).parent = this.personView.personView.node, 
        e.addComponent(I.default).init({
            id: 27,
            type: I.NewActivityEggType.MOVE,
            num: 10,
            options: {
                pos: cc.v2(0, 100),
                size: cc.size(175, 200),
                personView: this.personView.personView,
                personIdx: 11
            }
        })), -1 == b.default.getInstance().checkEggPerson(29) && ((e = new cc.Node()).parent = this.personView.personView.node, 
        e.addComponent(k.default).init({
            id: 29,
            type: I.NewActivityEggType.MOVE,
            num: 10,
            options: {
                pos: cc.v2(0, 0),
                size: cc.size(250, 250),
                personView: this.personView.personView,
                personIdx: 3,
                path: "image/eggs/泽塔凹凸曼@2x",
                offect: cc.v2(100, 0)
            }
        }));
    }, e.prototype.showItem = function(e) {
        switch (d.default.getInstance().playAudio("按钮2"), e < this.toggleContainer.toggleItems.length && (this.toggleContainer.toggleItems[e].isChecked = !0), 
        e) {
          case 0:
            this.person.active = !1, this.skin.active = !1, this.petView.node.active = !0, this.equipView.node.active = !1;
            break;

          case 1:
            this.person.active = !0, this.skin.active = !0, this.petView.node.active = !1, this.equipView.node.active = !1, 
            this.personView.node.active = !0, this.gunView.node.active = !1;
            break;

          case 2:
            this.person.active = !0, this.skin.active = !0, this.petView.node.active = !1, this.equipView.node.active = !1, 
            this.personView.node.active = !1, this.gunView.node.active = !0;
            break;

          case 3:
            this.person.active = !0, this.skin.active = !1, this.petView.node.active = !1, this.equipView.node.active = !0;
            break;

          default:
            this.person.active = !1, this.skin.active = !1, this.petView.node.active = !0, this.equipView.node.active = !1;
        }
    }, a([ O(s.default) ], e.prototype, "petView", void 0), a([ O(s.default) ], e.prototype, "personView", void 0), 
    a([ O(s.default) ], e.prototype, "gunView", void 0), a([ O(s.default) ], e.prototype, "equipView", void 0), 
    a([ O(cc.Node) ], e.prototype, "person", void 0), a([ O(cc.Node) ], e.prototype, "skin", void 0), 
    a([ O(cc.ToggleContainer) ], e.prototype, "toggleContainer", void 0), a([ S ], e);
}(c.default);

n.default = T;